/**
 * Load and Display an OBJ Shape. 
 * 
 * The loadShape() command is used to read simple SVG (Scalable Vector Graphics)
 * files and OBJ (Object) files into a Processing sketch. This example loads an
 * OBJ file of a rocket and displays it to the screen. 
 */


PShape rocket;

float ry;
int t=0;
public void setup() {
  size(640, 560, P3D);

  rocket = loadShape("rocket.obj");
}

public void draw() {
  camera(width/2.0, height/2.0 + tan(t) * 560/2 , (height/2.0) / tan(PI*30.0 / 180.0), width/2.0, height/2.0, 0, 0, 1, 0);
  background(0);
  lights();
  t=t+2;
  translate(width/2, height/2 + 100 - t, -400);
  rotateZ(PI);
  rotateY(ry);
  shape(rocket);
  rotateY(-ry + PI);
  translate(0, -95-t, 0);
  box(300, 10, 220);
  
  ry += 0.02;
}

